package cate.common.table.call.row;

import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import cate.common.util.random.RWItem;

public class CallWeightRow extends ERow implements RWItem {
    public int group;
    public int heroId;
    public double weight;
    public String rewardStr;
    public String fragmentStr;
    public boolean notice;

    @Override
    public void parse(XSSFRowWrap xrw) {
        super.parse(xrw);
        this.id = xrw.getInteger("ID");
        this.group = xrw.getInteger("星组ID");
        this.heroId = xrw.getInteger("英雄ID", -1);
        this.weight = xrw.getDouble("权重", 1.0);
        this.rewardStr = xrw.getString("额外奖励", "");
        this.fragmentStr = xrw.getString("英雄碎片", "");
        this.notice = xrw.getBoolean("全服公告", false);
    }

    @Override
    public double getWeight() {
        return weight;
    }

    public int getHeroId() {
        return heroId;
    }

    public CallWeightRow copy() {
        CallWeightRow row = new CallWeightRow();
        row.id = this.id;
        row.group = this.group;
        row.heroId = this.heroId;
        row.weight = this.weight;
        row.rewardStr = this.rewardStr;
        row.fragmentStr = this.fragmentStr;
        row.notice = this.notice;
        return row;
    }
}
